const CopyWebpackPlugin = require("copy-webpack-plugin");
const path = require("path");

// Generate pages object
const pagesObj = {};

const pages = ["workbench", "article", "ewechat", "index"];

pages.forEach((name) => {
  pagesObj[name] = {
    entry: `src/${name}/main.js`,
    template: `src/${name}/index.html`,
    filename: `${name}.html`,
  };
});

// console.log('pagesObj', pagesObj);

let plugins = [
  new CopyWebpackPlugin([
    {
      from: path.resolve("src/assets"),
      to: `${path.resolve("dist")}/assets`,
    },
  ]),
];


module.exports = {
  // pages: pagesObj, //多入口
  lintOnSave: false,
  publicPath:'./',
  configureWebpack: {
    // plugins: plugins,
  },
  devServer: {
    port: 8777,   // 端口号
    disableHostCheck: true,
  }
};
